-
Notifications
You must be signed in to change notification settings - Fork 771
Add examples of server and client for streamable http transport #294
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// After handling the request, if we get a session ID back, store the transport | ||
await transport.handleRequest(req, res, req.body); | ||
|
||
// Store the transport by session ID for future requests | ||
if (transport.sessionId) { | ||
transports[transport.sessionId] = transport; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, there's a race condition here AFAICT. I believe this sequence of events is possible:
- Client sends initialization request to server
- Server handles the request, assigns a session ID, and sends an initialization response
- Before line 102 is reached, the client sends another request
- Server can't find the session matching its ID
This might be something we have to fix in the interfaces we offer—for example, maybe a callback like onsessioncreated
or something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, good point, the session management is still in the follow ups, I'll address it there if that's okay
Does anyone have a Python SDK link where the work might have started? We can't use TypeScript unfortunately :( |
add support for Streamable HTTP server
When adding new features to the transport it's quite useful to have e2e flow to test on. Introducing the examples folder where we can have examples of mcp clients and servers with different features. Adding a very simple example of:
Follow ups